package leetcode.code2130;

import java.util.ArrayList;
import java.util.List;

import leetcode.IDebug;
import leetcode.helper.tree.ListNode;

public class Solution implements IDebug {

	public int pairSum(ListNode head) {
		List<Integer> list = new ArrayList<>();
		while (head != null) {
			list.add(head.val);
			head = head.next;
		}
		int n = list.size();
		int n1 = n - 1;
		int n2 = n >> 1;
		int max = 0;
		for (int i = 0; i < n2; i++) {
			int cur = list.get(i) + list.get(n1 - i);
			max = Math.max(max, cur);
		}
		return max;
	}

	@Override
	public void debug1() {
		// TODO Auto-generated method stub

	}

	@Override
	public void debug2() {
		// TODO Auto-generated method stub

	}

	@Override
	public void debug3() {
		// TODO Auto-generated method stub

	}

	@Override
	public void debug4() {
		// TODO Auto-generated method stub

	}

	public static void main(String[] args) {
		// TODO Auto-generated method stub

	}

}
